<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="bean.User" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: liuchangling
  Date: 2021/5/30
  Time: 5:19 下午
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
</head>
<style>
    h1 {
        text-align: center;
    }
</style>
<body style="padding:100px;">
<h1>编辑学员信息</h1>
<%
    boolean isCheckedMale = false;
    List<User> list = (List<User>) session.getAttribute("result");
    User user = list.get(0);
    if (user.getSex().equals("male")) {
        isCheckedMale = true;
    } else if (user.getSex().equals("female")) {
        isCheckedMale=false;
    }
%>
<c:forEach var="user" items="${result}">
<form action="update" method="post">
    <div class="form-group"><label>工号</label></div>
    <div class="form-group">
        <input type="text" class="form-control" placeholder="工号" name="sno" value="${user.sno}">
    </div>
    <div class="form-group"><label>姓名</label>
        <input type="text" class="form-control" placeholder="姓名" name="name" value="${user.name}">
    </div>
    <div class="form-group">
        <label>性别</label><br>
        <label class="radio-inline"> <input type="radio" name="sex" id="male"> 男 </label>
        <label class="radio-inline"> <input type="radio" name="sex" id="female"> 女 </label>
    </div>
    <div class="form-group">
        <label>
            出生日期
        </label>
        <input type="date" class="form-control" name="birthday" value="${user.birthday}">
    </div>
    <div class="form-group"><label>邮箱</label>
        <input type="mail" class="form-control" placeholder="邮箱" name="mail" value="${user.mail}">
    </div>
    <div class="form-group"><label>备注</label>
        <input type="text" class="form-control" placeholder="备注信息" name="remark" value="${user.remark}">
    </div>
    <div class="form-group"><label>班级编号</label>
        <input type="text" class="form-control" placeholder="班级编号" name="classNo" value="${user.classNo}">
    </div>
    </c:forEach>
    <div class="form-group">
        <button class="btn btn-primary" type="submit">提交</button>
    </div>
</form>
</body>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>
    window.onload = function () {
        if (<%=isCheckedMale==true%>) {
            $("#male").prop('checked', 'checked');
        } else {
            $("#female").prop('checked', 'checked');
        }
    }
</script>
</html>
